<template>
  <div class="detail">
    <table border="1">
      <caption>商品详情</caption>
      <tr>
        <th>名称</th>
        <th>颜色</th>
        <th>库存</th>
      </tr>
      <tr>
        <td>{{ item.name }}</td>
        <td>{{ item.color }}</td>
        <td>{{ item.num }}</td>
      </tr>
  </table>
</div></template>

<script setup>
import { list } from "../mock.js";
import {useRouter,useRoute} from "vue-router";
const router = useRouter();
const route = useRoute();
const item = list.filter(element => element.id == route.params.id)[0] || {name:"test",color:"red0",num:200}

</script>

<style lang="less" scoped></style>
